
import { http }  from '../api'

//1.商家点击接单 配货中
function  shopReceiving ( orderId ) {

    return http({ url: `flash/supermarket/order/tip/storeToUser?loading`,data:{id:orderId}})
        .then(res => {
           

            if (res.code == 200) {
                
                return res.data
            
            } else {
                uni.showToast({
                    title: res.message || '请求失败，请稍后再试!',
                    icon: 'none'
                });
            }
        })
}

//2.商家点击配货完成 待配送
function  shopFinish ( orderId ) {

    return http({ url: `flash/supermarket/order/tip/delivery?loading`,data:{id:orderId}})
        .then(res => {
           

            if (res.code == 200) {
                
                return res.data
            
            } else {
                uni.showToast({
                    title: res.message || '请求失败，请稍后再试!',
                    icon: 'none'
                });
            }
        })
}
//3.快递 配送人员点击 开始配送
function  deliveryExpressReceiving ( orderId ) {

    return http({ url: `flash/supermarket/order/tip/express/toUser?loading`,data:{id:orderId}})
        .then(res => {
           

            if (res.code == 200) {
                
                return res.data
            
            } else {
                uni.showToast({
                    title: res.message || '请求失败，请稍后再试!',
                    icon: 'none'
                });
            }
        })
}
//3.商品 配送人员点击 开始配送
function  deliveryReceiving ( orderId ) {

    return http({ url: `flash/supermarket/order/tip/deliveryToUser?loading`,data:{id:orderId}})
        .then(res => {
           

            if (res.code == 200) {
                
                return res.data
            
            } else {
                uni.showToast({
                    title: res.message || '请求失败，请稍后再试!',
                    icon: 'none'
                });
            }
        })
}
//3.配送人员点击完成  输入签收码
function  deliveryFinish ( orderId , signInCode ) {

    return http({ url: `flash/supermarket/order/inputSignInCode?loading`,data:{id:orderId,signInCode:signInCode}})
        .then(res => {
           
            if (res.code == 200) {
                
                return res.data
            
            } else {
                uni.showToast({
                    title: res.message || '请求失败，请稍后再试!',
                    icon: 'none'
                });
            }
        })
}

export default { shopReceiving , shopFinish , deliveryReceiving  , deliveryFinish ,deliveryExpressReceiving }